package com.tzbank.wisdom.controller;

import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.netflix.config.validation.ValidationException;
import com.tzbank.wisdom.service.LoanShelfService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

/**
 * 贷款XML文件解析
 * @author wdj&&llz
 *
 */
@Api(tags = {"贷款XML文件解析"})
@RestController
@RequestMapping("product")
public class LoanShelfController {

		@Resource
		private LoanShelfService loanShelfService;
		
	    @ResponseBody
	    @PostMapping(value = "/xml")
	    @ApiOperation(value = "贷款XML文件解析", notes = "贷款XML文件解析")
		public Map<String,Object> getLoanXmlProduct() throws ValidationException, IOException{
	    	
	    	List list= new ArrayList<String>();
	
			Map<String, Object> m = new HashMap<>();
			m.put("SynFileName","prod产品文件1" );	
			list.add(m);
			return loanShelfService.getLoanXmlProduct(list);
		}
	    
	    @ResponseBody
	    @PostMapping(value = "/dat")
	    @ApiOperation(value = "贷款XML文件解析", notes = "贷款XML文件解析")
		public Map<String,Object> getLoanDat(){
	    	
	    	String filePath = "C:\\Users\\tzbank\\Desktop\\D36_DOT_MAP_INFO_20180604_001.dat";
	    		
	    		return loanShelfService.getLoanDat( filePath);
		}
	
	    	
}
